<gm:page title="Demo - Modify entry values" authenticate="false" onunload="clearList('modifiedSource')">

  <script>
    function showTruncatedTitles() {

      alert("running url conversion");      
            
      var originalSourceList = google.mashups.getObjectById('originalSource').getData();
      var modifiedSourceList = google.mashups.getObjectById('modifiedSource').getData();
      var titleGPath = new GPath('media:group/media:content/@url');
    
      /* Copy truncated titles */
      for (var i=0; i<originalSourceList.size(); i++) {
        var entry = originalSourceList.entryAt(i);
        
        var originalTitle = titleGPath.getValue(entry);
        var modifiedTitle = originalTitle + '?imgmax=640';
        titleGPath.setValue(entry, modifiedTitle);
        
        modifiedSourceList.addEntry(entry);
      }
    
      alert("Conversion complete");
    }
    function clearList(listName) {
      /*var list = google.mashups.getObjectById(listName);
      
      for (var i=list.getData().size()-1; i>=0; i-=1) {
        list.getData().removeEntry(list.getData().entryAt(i));
      }*/
    }
  </script>
    
  <style>
    h4 {
      margin-bottom: 5px;
    }
  </style>
    
  <div class="gm-app-header">
    <h2>Modifying element values using JavaScript regular expressions<h2>
  </div> 
    
  <div style="margin-bottom:15px">
  <h4>Original</h4>
  <gm:list id="originalSource" template="list" data="${myData}">
  </gm:list>
  </div>
  
  <div>
  <h4>Modified</h4>
  <gm:list id="modifiedSource" template="list" data="${tmp}/test"/>
  </div>
  
    
<form>
<input type="button" value="Click me!"
onclick="showTruncatedTitles()" />
</form>
  
  <gm:data id="myData" data="http://picasaweb.google.com/data/feed/base/user/wrodge/albumid/4978915893951332369?kind=photo&alt=atom&hl=en_US"/>
    
  <gm:template id="list">
    <table>
     <tr repeat="true" style="padding: 5px">
        <td><gm:image ref='media:group/media:content/@url'/></td>
     </tr>
     </table>
  </gm:template>
    
</gm:page>